package com.chenjt.netty.eight_nio.simple;

import java.nio.IntBuffer;
import java.security.SecureRandom;

/**
 * 注释：
 *
 * @author chenjt
 * @date 2024/8/20 9:23
 */
public class NioTest1 {


    public static void main(String[] args) {
        IntBuffer buffer = IntBuffer.allocate(10);

        System.out.println("capacity:" + buffer.capacity());

        for(int i = 0;i<buffer.capacity();i++){
            int randomNumber = new SecureRandom().nextInt(20);
            buffer.put(randomNumber);
        }

        buffer.flip();

        while (buffer.hasRemaining()){
            System.out.println(buffer.get());
        }


    }

}
